import Dao.User;
import Dao.UserDao;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * @作者: xiaoxun
 * @日期: 2025/3/14 19:22
 * @描述:
 */
public class Demo01 {
	public static void main(String[] args) throws IOException {
		InputStream in=null;
		in= Resources.getResourceAsStream("SqlMapConfig.xml");
		SqlSessionFactoryBuilder builder=new SqlSessionFactoryBuilder();
		SqlSessionFactory factory=builder.build(in);
		SqlSession sqlSession=factory.openSession();
		UserDao userDao=sqlSession.getMapper(UserDao.class);
//		List<User> users=userDao.findAllUser();
		List<User> users=userDao.findAllUser();
//		System.out.println(users);
		for (User user:users){
			System.out.println(user);
		}
		in.close();
	}
}
